package com.zjuee.web.ledger.service.impl.handledata;

import com.zjuee.core.translation.handledata.impl.AbstractDataHandler;
import com.zjuee.vo.PlanTreatVo;
import com.zjuee.base.model.common.plan.PlanTreat;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component(value = "planTreatHandle")
public class PlanTreatHandle extends AbstractDataHandler {

    @Override
    public <T> T getData(T data, Map<Object, Object> map, String... str) {
        PlanTreat planTreat = (PlanTreat) data;
        PlanTreatVo planTreatVo = new PlanTreatVo();
        BeanUtils.copyProperties(planTreat, planTreatVo);
        String wptType = planTreat.getWptType();
        if (wptType.equals("11") || wptType.equals("12")) {
            planTreatVo.setWptDisposeTypeStr(map.get(planTreat.getWptDisposeType() + "" + str[0]) == null ? "" : map.get(planTreat.getWptDisposeType() + "" + str[0]).toString());
            planTreatVo.setWptDisposeStypeStr(map.get(planTreat.getWptDisposeStype() + "" + str[1]) == null ? "" : map.get(planTreat.getWptDisposeStype() + "" + str[1]).toString());
        } else {
            planTreatVo.setWptDisposeTypeStr(map.get(planTreat.getWptDisposeType() + "" + str[2]) == null ? "" : map.get(planTreat.getWptDisposeType() + "" + str[2]).toString());
            planTreatVo.setWptDisposeStypeStr(map.get(planTreat.getWptDisposeStype() + "" + str[3]) == null ? "" : map.get(planTreat.getWptDisposeStype() + "" + str[3]).toString());
        }
        return (T) planTreatVo;
    }
}